package model.core.code;

public abstract class IEntrance {
	protected int id;
	protected String entName;
	protected EntranceType type;
	
	public IEntrance(String entName) {
		id = -1;
		if(entName == null) {
			throw new RuntimeException("entrance name should not be null");
		}
		this.entName = entName;
		type = EntranceType.TYPE;
	}
	
	public int getID() {
		return id;
	}
	
	public void setID(int id) {
		this.id = id;
	}
	
	public String getName() {
		return entName;
	}
	
	@Override
	public boolean equals(Object o) {
		if(o instanceof IEntrance) {
			IEntrance ent = (IEntrance)o;
			return ent.entName.equals(this.entName) && this.id == ent.id;
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		return entName.hashCode();
	}
	
	public void setEntranceType(EntranceType type) {
		this.type = type;
	}
	
	public EntranceType getEntranceType() {
		return type;
	}
}
